package renmopr.tourguide.interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import renmopr.tourguide.controller.BaseController;

import javax.servlet.http.HttpServletResponse;

public class CrosInterceptor implements Interceptor {
    @Override
    public void intercept(Invocation invocation) {
        if (invocation.isActionInvocation()) {
            BaseController controller = (BaseController) invocation.getController();
            HttpServletResponse response = controller.getResponse();
            response.setHeader("Access-Control-Allow-Origin", "*");
            //response.setHeader("Access-Control-Allow-Headers", "Content-Type,X-Request-With");
        }
    }
}
